package com.albaba.designpattern.state_pattern.text_001;

/**
 * @Description: 上下文类
 * @Author zx
 * @Date 2025/2/25 15:15
 * @Version 1.0
 */
public class Context {

    // 维持一个对状态对象的引用
    private State currentState;

    public Context() {
        this.currentState = null;
    }

    public Context(State currentState) {
        this.currentState = currentState;
    }

    public State getCurrentState() {
        return currentState;
    }

    public void setCurrentState(State currentState) {
        this.currentState = currentState;
    }

    @Override
    public String toString() {
        return "Context{" +
                "currentState=" + currentState +
                '}';
    }
}
